#coding=utf-8
from flask import Flask
from flask import request
import json
app=Flask(__name__)
@app.route('/',methods=['GET'])
def login():
    user_name=request.args.get("username")
    pass_word=request.args.get("password")
    # 从url中获取user_name和pass_word参数并传入到的下面的data数据中
    if user_name and pass_word:
        # 判断user_name 和pass_word的值同时为true
        data=json.dumps({
        "username":user_name,
        "password":pass_word,
        "status_code":"200",
        "message":"Get接口请求成功",
        "info":"test info ....."},ensure_ascii=False)

        # http://127.0.0.1:5000/?username=aaa&password=bbb
    else:
        data=json.dumps({
            "message":"invalid method"
        },ensure_ascii=False)
    return data
if __name__ == "__main__":
    app.run()